import { createElement } from "react";
import EnumRouter from "./EnumRouter";
import { getEnv } from "./EnumEnv";
// import { systemRoutes } from "@/components/app/commonSystemSetting";
import { systemRoutes } from "@/components/app/sys";
import { IconWindElement } from "@/icon"

/**
 * 获取应用系统的路由
 */
export const getAppRoutes = () => {
  const env = getEnv();

  const appRoutes: RouteConfig[] = [
    {
      path: EnumRouter.login,
      component: import("@/components/app/sys/pages/login"),
    },
    {
      path: EnumRouter.appRoot,
      component: require("@/layouts/MainLayout").default,
      isLayout: true,
      props: Object.assign({
        title: env.app.title,
        logo: env.app.logo,
        splitMenus: true,       // 注意：当layout为"side"|"top"时，需要设置为false, 当layout为"mix"时，需要设置为true
        layout: "mix",          // "side" | "top" | "mix"
        fixedHeader: true,
        fixSiderbar: true,
        navTheme: "dark",       // "light" | "dark"
        isShowLogo: true,       // 是否显示logo和标题
        isShowTopHeader: true,  // 是否显示头部
        pure: false,            // 是否去掉不渲染
      }),
      children: [
        {
          path: EnumRouter.demoModuleRoot,
          name: '常用功能',
          icon: createElement(require("@ant-design/icons").AppstoreOutlined),
          children: [
            {
              path: EnumRouter.demoAntdTheme,
              name: "antd主题",
              icon: createElement(require("@ant-design/icons").OneToOneOutlined),
              component: import("@/pages/demos/antdTheme")
            },
            {
              path: EnumRouter.demoJsonSchemaForm,
              name: "Json Schema表单",
              icon: createElement(require("@ant-design/icons").OneToOneOutlined),
              component: import("@/pages/demos/jsonSchemaForm")
            },
            {
              path: EnumRouter.demoProTableList,
              name: "pro-table组件",
              // 使用自定义icon组件
              icon: createElement(IconWindElement),
              component: import("@/pages/demos/tableList")
            },
            // {
            //   path: EnumRouter.demoThreeJs3D,
            //   name: "three.js 3D组件",
            //   icon: createElement(require("@ant-design/icons").OneToOneOutlined),
            //   component: import("@/pages/demos/threeJs3D")
            // },
            // {
            //   path: EnumRouter.demoCesium3D,
            //   name: "cesium.js 3D组件",
            //   icon: createElement(require("@ant-design/icons").OneToOneOutlined),
            //   component: import("@/pages/demos/cesium3D")
            // },
            {
              path: EnumRouter.demoEarth,
              name: "地球",
              icon: createElement(require("@ant-design/icons").OneToOneOutlined),
              component: import("@/pages/demos/earth")
            },
            // {
            //   path: EnumRouter.demoJessibuca,
            //   name: "Jessibuca播放器",
            //   icon: createElement(require("@ant-design/icons").OneToOneOutlined),
            //   component: import("@/pages/demos/jessibuca")
            // },
          ]
        },
        // {
        //   path: EnumRouter.networkSimulation,
        //   name: "模拟仿真",
        //   icon: createElement(require("@ant-design/icons").OneToOneOutlined),
        //   component: import("@/pages/networkSimulation")
        // },
        systemRoutes,
      ],
    },
  ];

  return appRoutes;
}




